
DST := v0:~/mro.name/blog/

CREATE := \
  public/wp-content/uploads/2009/06/bild-51-300x122.png \
  public/wp-content/uploads/2009/06/nix-transatlantik-300x173.png \
  public/wp-content/uploads/2010/06/iPhoneOS3_0-device-with-iOS4_0-SDK-300x111.png \
  public/wp-content/uploads/2011/01/alcocalc.curve_-300x200.png \
  public/wp-content/uploads/2011/01/alcocalc.curve_-300x200.png \
  public/wp-content/uploads/2011/01/alcocalc.drinks-200x300.png \
  public/wp-content/uploads/2011/01/alcocalc.edit_-200x300.png

%-300x200.png : %.png
	convert $^ -auto-orient -resize 300x200 -quality 60 -interlace plane -strip $@
	optipng -o 7 $@
%-200x300.png : %.png
	convert $^ -auto-orient -resize 200x300 -quality 60 -interlace plane -strip $@
	optipng -o 7 $@
%-300x122.png : %.png
	convert $^ -auto-orient -resize 300x122 -quality 60 -interlace plane -strip $@
	optipng -o 7 $@
%-300x173.png : %.png
	convert $^ -auto-orient -resize 300x173 -quality 60 -interlace plane -strip $@
	optipng -o 7 $@
%-300x111.png : %.png
	convert $^ -auto-orient -resize 300x111 -quality 60 -interlace plane -strip $@
	optipng -o 7 $@

all: xmllint hugo images

hugo:
	${HOME}/bin/hugo

images: ${CREATE}
	ls $^

xmllint: ./tools/atom.rng $(wildcard ./content/posts/*/comments.xml)
	xmllint --noout --relaxng $^

publish: all
	rsync \
	  --bwlimit=80 \
	  --delete \
	  --delete-excluded \
	  --exclude '.DS_Store' \
	  --exclude '*.raw*' \
	  --exclude 'resources*' \
	  -aPz \
	  public/ "${DST}"

clean:
	rm -rf public
